From: Richard M. Stallman Date: Sat, 25 Jun 1994 22:34:25 +0000 (+0000) Subject: (BUF_PTR_CHAR_POS): New macro. X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1^2~5^2~91001 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=790f39e7815fde07bbccc64b67e3d9fa079540aa;p=emacs.git (BUF_PTR_CHAR_POS): New macro. --- diff --git a/src/buffer.h b/src/buffer.h index 499a8629afa..2e2f3fbfe23 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -130,6 +130,13 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ((ptr) - (current_buffer)->text.beg \ - (ptr - (current_buffer)->text.beg < (unsigned) GPT ? 0 : GAP_SIZE) \ + 1) + +/* Convert the address of a char in the buffer into a character position. */ +#define BUF_PTR_CHAR_POS(buf, ptr) \ +((ptr) - (buf)->text.beg \ + - (ptr - (buf)->text.beg < (unsigned) BUF_GPT ((buf)) \ + ? 0 : BUF_GAP_SIZE ((buf))) \ + + 1) struct buffer_text {